package com.yang.doctorrecruitment.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.yang.doctorrecruitment.dao.UserloginDAO;

public class FindUserAction extends ActionSupport{
	 private String UserName;
     public String execute() throws Exception{
    HttpServletRequest request=ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();
    String username=request.getParameter("UserName");
   	 boolean res= UserloginDAO.findUserByUserName(username);
   	 System.out.print(username+"----------------");
   	 if(res){
   		response.getWriter().write("1");
   	 }else if(username.equals("")){
   		response.getWriter().write("2");
   	 }else{
   		response.getWriter().write("0");
   	 }
   	 return null;
     }
	 public String getUserName() {
		return UserName;
	}
	public void setUserName(String userName) {
		UserName = userName;
	}
	
}
